# backend/models/__init__.py
"""
模型模块初始化
"""

from .base_model import BaseAIModel, AIModelResponse
from .openai_model import OpenAIModel
from .anthropic_model import AnthropicModel

# 模型工厂
class ModelFactory:
    """模型工厂类"""
    
    _models = {
        "GPT-4": OpenAIModel,
        "文心一言": BaiduModel,
        "通义千问": AliModel,
        "Claude": AnthropicModel,
        "豆包": ByteDanceModel,
    }
    
    @classmethod
    def create_model(cls, model_name: str, api_key: str) -> BaseAIModel:
        """创建模型实例"""
        if model_name not in cls._models:
            raise ValueError(f"不支持的模型: {model_name}")
        
        model_class = cls._models[model_name]
        return model_class(model_name, api_key)
    
    @classmethod
    def get_supported_models(cls) -> list[str]:
        """获取支持的模型列表"""
        return list(cls._models.keys())

__all__ = [
    "BaseAIModel",
    "AIModelResponse", 
    "OpenAIModel",
    "AnthropicModel",
    "ModelFactory"
]